<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/webpage/include/taglib.jsp"%>
<html>
<head>
	<title>应收结算单管理</title>
	<meta name="decorator" content="ani"/>
	<script type="text/javascript">
		var validateForm;
		var $table; // 父页面table表格id
		var $topIndex;//弹出窗口的 index
		function doSubmit(table, index){//回调函数，在编辑和保存动作时，供openDialog调用提交表单。
		  if(validateForm.form()){
			  $table = table;
			  $topIndex = index;
			  jp.loading();
			  $("#inputForm").submit();
			  return true;
		  }

		  return false;
		}

		$(document).ready(function() {
			validateForm = $("#inputForm").validate({
				submitHandler: function(form){
					jp.post("${ctx}/fee/js/save",$('#inputForm').serialize(),function(data){
						if(data.success){
	                    	$table.bootstrapTable('refresh');
	                    	jp.success(data.msg);
	                    	jp.close($topIndex);//关闭dialog

	                    }else{
            	  			jp.error(data.msg);
	                    }
					})
				},
				errorContainer: "#messageBox",
				errorPlacement: function(error, element) {
					$("#messageBox").text("输入有误，请先更正。");
					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
						error.appendTo(element.parent().parent());
					} else {
						error.insertAfter(element);
					}
				}
			});
			
		});
	</script>
</head>
<body class="bg-white">
		<form:form id="inputForm" modelAttribute="js" class="form-horizontal">
		<form:hidden path="id"/>
		<sys:message content="${message}"/>	
		<table class="table table-bordered">
		   <tbody>
		   <tr>
			   <td class="width-15 active"><label class="pull-right">开票金额：</label></td>
			   <td class="width-35">
				   <form:input path="kpje" htmlEscape="false"  readonly="true"  class="form-control required"/>
			   </td>
			   <td class="width-15 active"><label class="pull-right">开票日期：</label></td>
			   <td class="width-35">
				   <input name="date" htmlEscape="false" value="<fmt:formatDate value="${js.date}" pattern="yyyy-MM-dd HH:dd"/>" class="form-control required"/>
			   </td>
		   </tr>
		   <tr>
			   <td class="width-15 active"><label class="pull-right">受票方：</label></td>
			   <td class="width-35">
				   <form:input path="spf" htmlEscape="false"    class="form-control required"/>
			   </td>
			   <td class="width-15 active"><label class="pull-right">服务名称：</label></td>
			   <td class="width-35">
				   <form:input path="fwmc" htmlEscape="false"    class="form-control required"/>
			   </td>
		   </tr>
		   <tr>
			   <td class="width-15 active"><label class="pull-right">规格：</label></td>
			   <td class="width-35">
				   <form:input path="gg" htmlEscape="false"    class="form-control required"/>
			   </td>
			   <td class="width-15 active"><label class="pull-right">单位：</label></td>
			   <td class="width-35">
				   <form:input path="dw" htmlEscape="false"    class="form-control required"/>
			   </td>
		   </tr>
		   <tr>
			   <td class="width-15 active"><label class="pull-right">数量：</label></td>
			   <td class="width-35">
				   <form:input path="sl" htmlEscape="false"    class="form-control required"/>
			   </td>
			   <td class="width-15 active"><label class="pull-right">单价：</label></td>
			   <td class="width-35">
				   <form:input path="dj" htmlEscape="false"    class="form-control required"/>
			   </td>
		   </tr>
		   <tr>
			   <td class="width-15 active"><label class="pull-right">发票号：</label></td>
			   <td class="width-35">
				   <form:input path="fph" htmlEscape="false"    class="form-control required"/>
			   </td>
			   <td class="width-15 active"><label class="pull-right">备注：</label></td>
			   <td class="width-35">
				   <form:input path="remarks" htmlEscape="false"    class="form-control "/>
			   </td>
		   </tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">状态：</label></td>
					<td class="width-35">
						<form:input path="status" htmlEscape="false" readonly="true"   class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">核销金额：</label></td>
					<td class="width-35">
						<form:input path="hxje" htmlEscape="false" readonly="true"   class="form-control "/>
					</td>
				</tr>
				<tr>
					<td class="width-15 active"><label class="pull-right">未核销金额：</label></td>
					<td class="width-35">
						<form:input path="whxje" htmlEscape="false" readonly="true"   class="form-control "/>
					</td>
					<td class="width-15 active"><label class="pull-right">项目：</label></td>
					<td class="width-35">
						<form:input path="pro" htmlEscape="false" readonly="true"   class="form-control "/>
					</td>
				</tr>
		 	</tbody>
		</table>
			<div class="tabs-container">
				<ul class="nav nav-tabs">
					<li class="active" ><a data-toggle="tab" href="#tab-1" aria-expanded="true">结算单明细：</a>
					</li>
					<li ><a data-toggle="tab" href="#tab-2" aria-expanded="true">核销明细：</a>
					</li>
				</ul>
				<div class="tab-content">
					<div id="tab-1" class="tab-pane fade  in  active">
						<table class="table table-striped table-bordered table-condensed">
							<thead>
							<tr>
								<th>装运单号</th>
								<th>提货单号</th>
								<th>结算金额</th>
							</tr>
							</thead>
							<tbody >
							<c:forEach items="${list}" var="c">
								<tr>
									<td>${c.zydh}</td>
									<td>${c.thdh}</td>
									<td>${c.jsje}</td>
								</tr>

							</c:forEach>
							</tbody>
						</table>


					</div>
					<div id="tab-2" class="tab-pane fade  ">
						<table class="table table-striped table-bordered table-condensed">
							<thead>
							<tr>
								<th>收款人</th>
								<th>收款时间</th>
								<th>收款方式</th>
								<th>收款金额</th>
								<th>票据号码</th>
								<th>备注</th>
							</tr>
							</thead>
							<tbody >
							<c:forEach items="${l}" var="c">
								<tr>
									<td>${c.person}</td>
									<td><fmt:formatDate value="${c.date}" pattern="yyyy-MM-dd HH:00"/></td>
									<td>${c.type}</td>
									<td>${c.money}</td>
									<td>${c.fee}</td>
									<td>${c.remarks}</td>
								</tr>

							</c:forEach>
							</tbody>
						</table>


					</div>
				</div>
			</div>
	</form:form>
</body>
</html>